﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PlatWL.Data;
using System.Data;
using System.Transactions;

namespace PlatWL.Services.ServicesWeb
{
    public class BaseManage
    {
        public void GetTypeList(ref Msg_Result msg, pt_user_account user, int Client, string infotype, int topid)
        {
            msg.result = new pt_base_categoryb().GetDTByCommand("select * from pt_base_category where Client=0 and ISShow=1 and InfoType='" + infotype + "' and TopID=" + topid + " order by Sort");

        }

        public void GetTypeList2(ref Msg_Result msg, pt_user_account user, int Client, string infotype, string ctype)
        {
            string sql = "SELECT Client,ID,InfoType,TypeName,Lvl,TopID,ISMsg FROM pt_base_category WHERE Client=0 AND InfoType=" + infotype + " AND ISShow=1 AND TopID=0 ";
            if (ctype != "")
            {
                sql += " and CType='" + ctype + "' ";
            }
            sql += " order by sort ";

            DataTable dt = new pt_base_categoryb().GetDTByCommand(sql);
            dt.Columns.Add("SubItem", typeof(DataTable));
            foreach (DataRow dr in dt.Rows)
            {
                dr["SubItem"] = new pt_base_categoryb().GetDTByCommand("SELECT Client,ID,InfoType,TypeName,Lvl,TopID,ISMsg FROM pt_base_category WHERE Client=0 AND ISShow=1 AND TopID=" + dr["ID"].ToString() + " order by sort ");
            }
            msg.result = dt;
        }


    }
}
